<% layout('/layouts/default.html', {title: '考核任务指标表管理', libs: ['dataGrid','fileupload','validate','tabPage']}){ %>
<div class="main-content">


		<div>
			<#form:form id="searchForm" model="${dcSupExamSumQuotaInfo!}" action="${ctx}/home/homePage/queryWorkList" method="post" class="form-inline "
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize!100}" data-order-by="${parameter.orderBy}">
		    </#form:form>
	    </div>


	<div class="box-body" >
		<div class="huizong">

			<p style="background-color: #ACCD3C" onclick="statuDetails(1)">
				<span>全部任务</span>
				<span id="allSate">0</span>
			</p>
			<p style="background-color: #ff4d4d" onclick="statuDetails(1)">
				<span>进度滞后</span>
				<span id="zhiSate">0</span>
			</p>
			<p style="background-color: #ff8b19" onclick="statuDetails(2)">
				<span>逾期反馈</span>
				<span id="yuqiSate">0</span>
			</p>
			<p style="background-color: #4b87ff" onclick="statuDetails(3)">
				<span>序时推进</span>
				<span id="xushiSate">0</span>
			</p>
			<p style="background-color: #1abd6e" onclick="statuDetails(4)">
				<span>已完成</span>
				<span id="wanSate">0</span>
			</p>
		</div>
	</div>
	<div class="box-body">

		<table id="dataGrid"></table>
		<div id="dataGridPage"></div>
	</div>
</div>



<% } %>
<style>
	.huizong{
		height: 60px;
		display: -webkit-box;
		display: -ms-flexbox;
		display: flex;
		-ms-flex-pack: distribute;
		justify-content: space-around;
	}
	.huizong p{
		display: flex;
		border-radius: 4px;
		text-align: center;
		height: 60px;

		margin-right: 35px;
		cursor: pointer;
	}
	.huizong p span{
		display: block;
		color: #fff;
		font-size: 18px;
		padding-top: 20px;
	}
	.huizong p:last-child {
		margin-right: 0;
	}
</style>
<script>
	$(function () {
		leaderStatistics('5','${@UserUtils.getUser().getUserCode()}');
	})

	function leaderStatistics(timeParam,taskLeader) {
		$.ajax({
			url: "${ctx}/home/homePage/getRedBlue",
			type: "post",
			cache: false,
			data: {"timeParam":timeParam,"taskLeader":taskLeader},
			dataType: "json",
			success: function(res){
				$("#zhiSate").text(res[1]);
				$("#yuqiSate").text(res[2]);
				$("#xushiSate").text(res[3]);
				$("#wanSate").text(res[4]);
				$("#allSate").text(res[1]+res[2]+res[3]+res[4])
			}
		});
	}

// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	sortableColumn: false, // 列表不允许排序
	columnModel: [
		{header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", hidden:true},
		{header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left"
			, formatter: function(val, obj, row, act){
				var title =encodeURIComponent(row.taskTitle);
				return '<a href="${ctx}/home/homePage/leaderChirdDown?searchType=accurate&taskTitle='+title+'&taskLeader='+row.taskLeader+'&timeParam='+ $("#searchForm #timeParam").val()+'" class="btnList" data-title="${text("任务明细")}">'+(val||'暂无标题')+'</a>';
			}
		},
		{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left"},
		{header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_name', width:150, align:"center"},
		 {header:'${text("牵头责任单位")}', name:'taskLeaderOrgName', index:'a.leader_org_name', width:150, align:"center"},
		{header:'${text("牵头领导")}', name:'taskLeaderName', width:150, align:"left"},
		{header:'${text("任务状态")}', name:'taskProgress', index:'a.task_progress', width:50, align:"center", frozen:true, formatter: function(val, obj, row, act){
				var taskSaF = row.taskProgress;
				if (taskSaF == '1'){
					//已完成
					return '<span  style="display: inline-block;width: 10px;height: 10px;border-radius: 50%;background-color: #1abd6e;margin-right: 5px;"></span>';
				}else if(taskSaF =='2'){
					//序时推进
					return '<span  style="display: inline-block;width: 10px;height: 10px;border-radius: 50%;background-color: #4b87ff;margin-right: 5px;"></span>';
				}else if(taskSaF == '3'){
					//进度滞后
					return '<span  style="display: inline-block;width: 10px;height: 10px;border-radius: 50%;background-color: #ff4d4d;margin-right: 5px;"></span>';
				}else if(taskSaF == '4'){
					//进度滞后
					return '<span  style="display: inline-block;width: 10px;height: 10px;border-radius: 50%;background-color: #ff4d4d;margin-right: 5px;"></span>';
				}else{
					return '';
				}
			}
		}
	],
	autoGridHeight: true,
	ajaxSuccess: function(data){

	}
});

function cz(){
	searchForm.reset();
	$('#dataGrid').dataGrid('reloadGrid');
}
</script>